package com.bos.domain;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * Created by IntelliJ IDEA.
 * User: Latief
 * Date: 3/11/11
 * Time: 9:57 PM
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "bank")
public class Bank implements DomainObject{

    @Id
    @GeneratedValue
    private long id;

    @NotNull
    @Size(min = 1, max = 50)
    private String nama;

    public Bank() {
    }

    public Bank(String nama) {
        this.nama = nama;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getNama() {
        return nama;
    }

    public void setNama(String nama) {
        this.nama = nama;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Bank)) return false;

        Bank bank = (Bank) o;

        if (id != bank.id) return false;
        if (nama != null ? !nama.equals(bank.nama) : bank.nama != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) (id ^ (id >>> 32));
        result = 31 * result + (nama != null ? nama.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "Bank{" +
                "id=" + id +
                ", nama='" + nama + '\'' +
                '}';
    }
}
